﻿namespace WMS6.Web.Configuration
{
    using System;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using WMS6.Web;

    public class SkuClassQuery : BasePage
    {
        protected Button btnExport;
        protected Button btnList;
        protected Button btnNew;
        protected Button btnSearch;
        protected DropDownList ddlDescr;
        protected DropDownList ddlDescr2;
        protected DropDownList ddlIsActive;
        protected DropDownList ddlIsActiveOper;
        protected DropDownList ddlOwnerID;
        protected DropDownList ddlSkuClassID;
        protected HtmlForm F2090;
        protected HtmlInputHidden hdnActionID;
        protected HtmlHead Head1;
        protected Label lblBu;
        protected Label lblCarton;
        protected Label lblDescr;
        protected Label lblDescr2;
        protected Label lblIsActive;
        protected Label lblSkuClassID;
        protected HtmlLink mycss;
        protected ScriptManager ScriptManager1;
        protected TextBox txtDescr;
        protected TextBox txtDescr2;
        protected TextBox txtOwnerID;
        protected TextBox txtSkuClassID;

        protected void btnList_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("SkuClassList.aspx?action={0}&from=list", base.UrlEncode(this.hdnActionID.Value.Trim())), false);
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("SkuClassList.aspx?action={0}", base.UrlEncode(this.hdnActionID.Value.Trim())), false);
        }

        private void LoadDll()
        {
            base.InitQueryDDL(this.ddlOwnerID, 0);
            base.InitQueryDDL(this.ddlSkuClassID, 0);
            base.InitQueryDDL(this.ddlDescr, 0);
            base.InitQueryDDL(this.ddlDescr2, 0);
            base.InitQueryDDL(this.ddlIsActiveOper, 0);
            base.InitIsActiveDDL(this.ddlIsActive, 0);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                base.InitPage(this.Page);
                this.LoadDll();
                if (!string.IsNullOrEmpty(base.Request.QueryString["action"]))
                {
                    if (!string.IsNullOrEmpty(base.Request.QueryString["ownerid"]))
                    {
                        this.txtOwnerID.Text = base.Request.QueryString["ownerid"];
                        this.txtOwnerID.Enabled = false;
                    }
                    this.btnNew.Visible = false;
                    this.btnExport.Visible = false;
                    this.ddlIsActive.SelectedValue = "Y";
                    this.ddlIsActive.Enabled = false;
                }
            }
        }

        public string Descr
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtDescr.Text.Trim()))
                {
                    return base.GetParamsString(this.txtDescr.Text.Trim(), this.ddlDescr.SelectedValue);
                }
                return "";
            }
        }

        public string Descr2
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtDescr2.Text.Trim()))
                {
                    return base.GetParamsString(this.txtDescr2.Text.Trim(), this.ddlDescr2.SelectedValue);
                }
                return "";
            }
        }

        public string IsActive
        {
            get
            {
                if (!string.IsNullOrEmpty(this.ddlIsActive.SelectedValue))
                {
                    return base.GetParamsString(this.ddlIsActive.SelectedValue, this.ddlIsActiveOper.SelectedValue);
                }
                return "";
            }
        }

        public string OwnerID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtOwnerID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtOwnerID.Text.Trim(), this.ddlOwnerID.SelectedValue);
                }
                return "";
            }
        }

        public string SkuClassID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtSkuClassID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtSkuClassID.Text.Trim(), this.ddlSkuClassID.SelectedValue);
                }
                return "";
            }
        }
    }
}

